#pragma once

#include <process.h>
#include "Pipe.h"

class Misc
{
public:
	Misc(wchar_t *pipename, int x, int y);
	~Misc(void);
	bool isConnect(void);
	bool isConfiged(void);
	void SetScreen(int x, int y);
	void MouseEvent(int n, int x, int y, int k);
	void KeyDown(UINT vk, UINT scanCode);
	void KeyUp(UINT vk, UINT scanCode);
	void GpsEvent(char* buff);
	void SensorsEvent(char* buff);
private:

	HANDLE _pipeSeverWriteEvent;
	HANDLE _pipeSeverReadEvent;
	HANDLE _pipeSeverEndEvent;
	static void _cdecl LoopThread(void * pThis);
	void WaitPipeClientEnd();

	Pipe * m_pipe;
	bool   m_disableWindowInput;
	int    m_width = 0;
	int    m_height = 0;
	bool   m_isLoop = true;
	bool   m_isConfiged = false;
};